<html>
<head><meta charset="utf-8"><title>T-lang asking T-libs for per-edition preludes coordination · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html">T-lang asking T-libs for per-edition preludes coordination</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="209329658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209329658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209329658">(Sep 07 2020 at 21:54)</a>:</h4>
<p>Hello to T-libs!</p>
<p>T-lang has an MCP proposal for <a href="https://github.com/rust-lang/lang-team/issues/44">per-edition preludes</a>. For example, the 2021 prelude might also include the <code>TryInto</code> trait. The exact details of what goes into what prelude are out of scope at this time. What's being focused on at the moment is just the ability to do this <em>at all</em>. Naturally the prelude differences should be easy for users to understand and work with, so we'd want to have very clear explanations of what's going on.</p>
<p>Since this has quite a bit of effect on what parts of the standard library get used and how, input is needed from T-libs as to what details they'd like to see as part of an RFC towards this.</p>
<p>Please comment either here in this topic or in the <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/MCP.3A.20per-edition.20preludes.20lang-team.2344">t-lang/major changes topic</a>, but <strong>not</strong> on the github issue itself, which is being reserved for progress updates only.</p>



<a name="209330765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209330765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209330765">(Sep 07 2020 at 22:17)</a>:</h4>
<ul>
<li><code>TryInto</code> &amp; <code>TryFrom</code></li>
<li>New <code>panic</code> macro which only accepts format args, not arbitrary values.</li>
</ul>



<a name="209330844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209330844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209330844">(Sep 07 2020 at 22:19)</a>:</h4>
<p>only TryInto, not TryFrom?</p>



<a name="209331000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209331000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209331000">(Sep 07 2020 at 22:23)</a>:</h4>
<p>Well first let's focus on what would be in an RFC for doing this at all.</p>
<p>Is it really as simple as saying "we're gonna do it" and then we change a file or two and use the <code>edition</code> compiler flag to decide what the implicit prelude file is for that module? Or are there other concerns?</p>



<a name="209331333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209331333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209331333">(Sep 07 2020 at 22:30)</a>:</h4>
<p>Is it a problem that foreign macros won't know what prelude is in use?</p>



<a name="209331364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209331364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209331364">(Sep 07 2020 at 22:31)</a>:</h4>
<p>But I suppose a clean macro should even work with no prelude.</p>



<a name="209332478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209332478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209332478">(Sep 07 2020 at 22:57)</a>:</h4>
<p>One sticking point of this in the past that I've felt is that to me the goal of an edition is that if you're warning-free on the previous edition then you're guaranteed to compile successfully in the next edition. In 2018 we achieved this with a whole lot of lints warning you to change things if they were going to break. With a prelude change, however, I don't think there's been thought/development on what a lint would be for this. This means that a prelude change in an edition could make upgrading the edition more difficult for some projects (e.g. <code>cargo fix --edition</code> won't "just work"). I'm not sure what the actual fallout of this is, though, and it may be only a small handful of projects that don't compile with a new prelude</p>



<a name="209332539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209332539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209332539">(Sep 07 2020 at 22:59)</a>:</h4>
<p>could we add a lint for things that would conflict in the new version?</p>



<a name="209332541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209332541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209332541">(Sep 07 2020 at 22:59)</a>:</h4>
<p>things like 'don't define your own TryInto'?</p>



<a name="209332764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209332764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209332764">(Sep 07 2020 at 23:03)</a>:</h4>
<p>I feel like 99% of the actual problems from this are just <a href="https://lib.rs/crates/try_from">https://lib.rs/crates/try_from</a>, so we might also be able to do something in that crate to help.  Or even just special-case some warnings for that specifically, ...</p>



<a name="209333281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209333281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209333281">(Sep 07 2020 at 23:13)</a>:</h4>
<p>If the issue is literally TryFrom and TryInto conflicting with that crate, then the cargo fix --edition could literally just delete it from people's Cargo.toml manifests and its use statements elsewhere and see how that goes. <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="209333536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209333536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209333536">(Sep 07 2020 at 23:19)</a>:</h4>
<p>that would (potentially) involve all deps also already being updated, is the thing.</p>



<a name="209333709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209333709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209333709">(Sep 07 2020 at 23:22)</a>:</h4>
<p>I don't really understand Rust's scope model 100% here, would the dependencies have to be compiled "in the presence" of the new prelude?</p>



<a name="209335179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209335179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209335179">(Sep 08 2020 at 00:00)</a>:</h4>
<p>No, dependencies control their own edition (and prelude)</p>



<a name="209335193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209335193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209335193">(Sep 08 2020 at 00:00)</a>:</h4>
<p>Only macros blur that line</p>



<a name="209335876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209335876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209335876">(Sep 08 2020 at 00:14)</a>:</h4>
<p>the core TryFrom and the <code>try_from</code> crate TryFrom aren't the same TryFrom, is the problem, if there's any <code>try_from::TryFrom</code> impls that are being used across crates, then you need to update dep crates to use <code>core::convert::TryFrom</code> (as a breaking change) and then you can go up the build tree replacing the trait usage until the whole ecosystem moves over.</p>



<a name="209337351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209337351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209337351">(Sep 08 2020 at 00:56)</a>:</h4>
<p>It definitely seems plausible to have a rustfix lint thing that looks for imported trait methods called <code>try_from</code> that aren't from std's TryFrom and automatically convert them to UFCS without the import</p>



<a name="209337353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209337353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209337353">(Sep 08 2020 at 00:56)</a>:</h4>
<p>might be weird with glob imports?</p>



<a name="209348250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209348250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209348250">(Sep 08 2020 at 05:58)</a>:</h4>
<p>We might not be able to rustfix them away, but it should be pretty easy to detect them and tell people how to migrate.</p>



<a name="209348321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/T-lang%20asking%20T-libs%20for%20per-edition%20preludes%20coordination/near/209348321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/T-lang.20asking.20T-libs.20for.20per-edition.20preludes.20coordination.html#209348321">(Sep 08 2020 at 06:00)</a>:</h4>
<p>Also, to clarify something in terms of scope: the general sentiment of the lang team was that we'd be supportive of the minor language tweak needed to have a per-edition prelude, so we'd like to make that capability available to the libs team if you'd like it, and we're happy to delegate any and all decisions about the actual prelude changes to the libs team.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>